from django.core.urlresolvers import reverse
from django.utils.translation import get_language

from itertools import chain

def locreverse(*args, **kwargs):
    ar = kwargs.get('args')
    if ar:
        kwargs['args'] = chain((get_language(),), ar)
    else:
        kw = kwargs.setdefault('kwargs', {})
        kw.update(lang_code=get_language())
    return reverse(*args, **kwargs)
    